package com.xuxin.pda.presenter;

import com.xuxin.pda.bean.BaseBean;
import com.xuxin.pda.bean.LinkBean;
import com.xuxin.pda.contract.TrashLinkContract;
import com.xuxin.pda.model.TrashLinkModel;

/**
 * Created by xu_xin
 * Created on 2021/2/7 0007
 */
public class TrashLinkPresenter implements TrashLinkContract.Presenter {
    private final TrashLinkModel model;
    private final TrashLinkContract.View view;

    public TrashLinkPresenter(TrashLinkContract.View view) {
        this.view = view;
        model = new TrashLinkModel();
    }


    @Override
    public void link(String boxId, String packageCodes) {
        if (null != model) {
            model.link(this, boxId, packageCodes);
        }
    }

    @Override
    public void onSuccess(LinkBean linkBean) {
        if (null != view) {
            view.onSuccess(linkBean);
        }
    }

    /**
     * 以下内容复用
     */
    @Override
    public void onError(BaseBean baseBean) {
        if (null != view) {
            view.onError(baseBean);
        }
    }

    @Override
    public void onComplete() {
        if (null != view) {
            view.onComplete();
        }
    }
}